#include "gtkcssimagebuiltinprivate.h"
+#include "gtkcssenumvalueprivate.h"
+#include "gtkcssnumbervalueprivate.h"
+#include "gtkcssrgbavalueprivate.h"
+#include "gtkcssstyleprivate.h"
#include "gtkhslaprivate.h"
#include "gtkrenderprivate.h"
static GtkCssImage *the_one_true_image;
static void
-gtk_css_image_builtin_draw_check (GtkCssImage *image,
- cairo_t *cr,
- double width,
- double height,
- gboolean checked,
- gboolean inconsistent,
- const GdkRGBA * fg_color,
- const GdkRGBA * bg_color,
- const GdkRGBA * border_color,
- int border_width)
+gtk_css_image_builtin_draw_check (GtkCssImage *image,
+ cairo_t *cr,
+ double width,
+ double height,
+ gboolean checked,
+ gboolean inconsistent)
{
+ GtkCssImageBuiltin *builtin = GTK_CSS_IMAGE_BUILTIN (image);
gint x, y, exterior_size, interior_size, thickness, pad;
exterior_size = MIN (width, height);
x = - (1 + exterior_size - (gint) width) / 2;
y = - (1 + exterior_size - (gint) height) / 2;
- if (border_width > 0)
+ if (builtin->border_width > 0)
{
- cairo_set_line_width (cr, border_width);
+ cairo_set_line_width (cr, builtin->border_width);
cairo_rectangle (cr, x + 0.5, y + 0.5, exterior_size - 1, exterior_size - 1);
- gdk_cairo_set_source_rgba (cr, bg_color);
+ gdk_cairo_set_source_rgba (cr, &builtin->bg_color);
cairo_fill_preserve (cr);
- gdk_cairo_set_source_rgba (cr, border_color);
+ gdk_cairo_set_source_rgba (cr, &builtin->border_color);
cairo_stroke (cr);
}
- gdk_cairo_set_source_rgba (cr, fg_color);
+ gdk_cairo_set_source_rgba (cr, &builtin->fg_color);
if (inconsistent)
{
}
static void
-gtk_css_image_builtin_draw_option (GtkCssImage *image,
- cairo_t *cr,
- double width,
- double height,
- gboolean checked,
- gboolean inconsistent,
- const GdkRGBA * fg_color,
- const GdkRGBA * bg_color,
- const GdkRGBA * border_color,
- int border_width)
+gtk_css_image_builtin_draw_option (GtkCssImage *image,
+ cairo_t *cr,
+ double width,
+ double height,
+ gboolean checked,
+ gboolean inconsistent)
{
+ GtkCssImageBuiltin *builtin = GTK_CSS_IMAGE_BUILTIN (image);
gint x, y, exterior_size, interior_size, thickness, pad;
exterior_size = MIN (width, height);
x = - (1 + exterior_size - width) / 2;
y = - (1 + exterior_size - height) / 2;
- if (border_width > 0)
+ if (builtin->border_width > 0)
{
- cairo_set_line_width (cr, border_width);
+ cairo_set_line_width (cr, builtin->border_width);
cairo_new_sub_path (cr);
cairo_arc (cr,
(exterior_size - 1) / 2.,
0, 2 * G_PI);
- gdk_cairo_set_source_rgba (cr, bg_color);
+ gdk_cairo_set_source_rgba (cr, &builtin->bg_color);
cairo_fill_preserve (cr);
- gdk_cairo_set_source_rgba (cr, border_color);
+ gdk_cairo_set_source_rgba (cr, &builtin->border_color);
cairo_stroke (cr);
}
- gdk_cairo_set_source_rgba (cr, fg_color);
+ gdk_cairo_set_source_rgba (cr, &builtin->fg_color);
/* FIXME: thickness */
thickness = 1;
cairo_t *cr,
double width,
double height,
- GtkCssImageBuiltinType image_type,
- const GdkRGBA * color)
+ GtkCssImageBuiltinType image_type)
{
+ GtkCssImageBuiltin *builtin = GTK_CSS_IMAGE_BUILTIN (image);
double line_width;
double size;
cairo_rel_line_to (cr, size / 2.0, size / 2.0);
cairo_rel_line_to (cr, - size / 2.0, size / 2.0);
- gdk_cairo_set_source_rgba (cr, color);
+ gdk_cairo_set_source_rgba (cr, &builtin->fg_color);
cairo_stroke (cr);
}
static void
-gtk_css_image_builtin_draw_expander (GtkCssImage *image,
- cairo_t *cr,
- double width,
- double height,
- gboolean horizontal,
- gboolean is_rtl,
- gboolean expanded,
- const GdkRGBA * fg_color,
- const GdkRGBA * border_color)
+gtk_css_image_builtin_draw_expander (GtkCssImage *image,
+ cairo_t *cr,
+ double width,
+ double height,
+ gboolean horizontal,
+ gboolean is_rtl,
+ gboolean expanded)
{
+ GtkCssImageBuiltin *builtin = GTK_CSS_IMAGE_BUILTIN (image);
double vertical_overshoot;
int diameter;
double radius;
cairo_set_line_width (cr, line_width);
- gdk_cairo_set_source_rgba (cr, fg_color);
+ gdk_cairo_set_source_rgba (cr, &builtin->fg_color);
cairo_fill_preserve (cr);
- gdk_cairo_set_source_rgba (cr, border_color);
+ gdk_cairo_set_source_rgba (cr, &builtin->border_color);
cairo_stroke (cr);
}
cairo_t *cr,
double width,
double height,
- GtkCssImageBuiltinType image_type,
- const GdkRGBA *bg_color)
+ GtkCssImageBuiltinType image_type)
{
+ GtkCssImageBuiltin *builtin = GTK_CSS_IMAGE_BUILTIN (image);
GdkRGBA lighter, darker;
cairo_set_line_width (cr, 1.0);
- color_shade (bg_color, 0.7, &darker);
- color_shade (bg_color, 1.3, &lighter);
+ color_shade (&builtin->bg_color, 0.7, &darker);
+ color_shade (&builtin->bg_color, 1.3, &lighter);
/* align drawing area to the connected side */
if (image_type == GTK_CSS_IMAGE_BUILTIN_GRIP_LEFT)
}
void
-gtk_css_image_builtin_draw_pane_separator (GtkCssImage *image,
- cairo_t *cr,
- double width,
- double height,
- const GdkRGBA *bg_color)
+gtk_css_image_builtin_draw_pane_separator (GtkCssImage *image,
+ cairo_t *cr,
+ double width,
+ double height)
{
+ GtkCssImageBuiltin *builtin = GTK_CSS_IMAGE_BUILTIN (image);
GdkRGBA lighter, darker;
gint xx, yy;
cairo_set_line_width (cr, 1.0);
- color_shade (bg_color, 0.7, &darker);
- color_shade (bg_color, 1.3, &lighter);
+ color_shade (&builtin->bg_color, 0.7, &darker);
+ color_shade (&builtin->bg_color, 1.3, &lighter);
if (width > height)
for (xx = width / 2 - 15; xx <= width / 2 + 15; xx += 5)
}
void
-gtk_css_image_builtin_draw_handle (GtkCssImage *image,
- cairo_t *cr,
- double width,
- double height,
- const GdkRGBA *bg_color)
+gtk_css_image_builtin_draw_handle (GtkCssImage *image,
+ cairo_t *cr,
+ double width,
+ double height)
{
+ GtkCssImageBuiltin *builtin = GTK_CSS_IMAGE_BUILTIN (image);
GdkRGBA lighter, darker;
gint xx, yy;
cairo_set_line_width (cr, 1.0);
- color_shade (bg_color, 0.7, &darker);
- color_shade (bg_color, 1.3, &lighter);
+ color_shade (&builtin->bg_color, 0.7, &darker);
+ color_shade (&builtin->bg_color, 1.3, &lighter);
for (yy = 0; yy < height; yy += 3)
for (xx = 0; xx < width; xx += 6)
}
static void
-gtk_css_image_builtin_draw_spinner (GtkCssImage *image,
- cairo_t *cr,
- double width,
- double height,
- const GdkRGBA *color)
+gtk_css_image_builtin_draw_spinner (GtkCssImage *image,
+ cairo_t *cr,
+ double width,
+ double height)
{
+ GtkCssImageBuiltin *builtin = GTK_CSS_IMAGE_BUILTIN (image);
gdouble radius;
radius = MIN (width / 2, height / 2);
cairo_save (cr);
cairo_translate (cr, width / 2, height / 2);
- gdk_cairo_set_source_rgba (cr, color);
+ gdk_cairo_set_source_rgba (cr, &builtin->fg_color);
gtk_render_paint_spinner (cr, radius, -1);
cairo_restore (cr);
guint property_id,
GtkStyleProviderPrivate *provider,
int scale,
- GtkCssStyle *values,
- GtkCssStyle *parent_values,
+ GtkCssStyle *style,
+ GtkCssStyle *parent_style,
GtkCssDependencies *dependencies)
{
- return g_object_ref (image);
+ GtkCssImageBuiltin *result;
+ GtkBorderStyle border_style;
+
+ result = g_object_new (GTK_TYPE_CSS_IMAGE_BUILTIN, NULL);
+
+ border_style = _gtk_css_border_style_value_get (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_BORDER_TOP_STYLE));
+ if (border_style == GTK_BORDER_STYLE_SOLID)
+ {
+ GtkBorder border;
+
+ border.top = _gtk_css_number_value_get (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_BORDER_TOP_WIDTH), 100);
+ border.right = _gtk_css_number_value_get (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_BORDER_RIGHT_WIDTH), 100);
+ border.bottom = _gtk_css_number_value_get (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_BORDER_BOTTOM_WIDTH), 100);
+ border.left = _gtk_css_number_value_get (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_BORDER_LEFT_WIDTH), 100);
+
+ result->border_width = MIN (MIN (border.top, border.bottom),
+ MIN (border.left, border.right));
+ }
+
+ result->fg_color = *_gtk_css_rgba_value_get_rgba (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_COLOR));
+ result->bg_color = *_gtk_css_rgba_value_get_rgba (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_BACKGROUND_COLOR));
+ result->border_color = *_gtk_css_rgba_value_get_rgba (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_BORDER_TOP_COLOR));
+
+ /* XXX: We also depend on other values, but I guess we cannot express that */
+ *dependencies = GTK_CSS_DEPENDS_ON_COLOR;
+
+ return GTK_CSS_IMAGE (result);
}
static gboolean
gtk_css_image_builtin_equal (GtkCssImage *image1,
GtkCssImage *image2)
{
- return TRUE;
-}
+ GtkCssImageBuiltin *builtin1 = GTK_CSS_IMAGE_BUILTIN (image1);
+ GtkCssImageBuiltin *builtin2 = GTK_CSS_IMAGE_BUILTIN (image2);
-static GtkCssImage *
-gtk_css_image_builtin_transition (GtkCssImage *start,
- GtkCssImage *end,
- guint property_id,
- double progress)
-{
- /* builtin images always look the same, so start == end */
- return g_object_ref (start);
+ return gdk_rgba_equal (&builtin1->fg_color, &builtin2->fg_color)
+ && gdk_rgba_equal (&builtin1->bg_color, &builtin2->bg_color)
+ && gdk_rgba_equal (&builtin1->border_color, &builtin2->border_color)
+ && builtin1->border_width == builtin2->border_width;
}
static void
image_class->print = gtk_css_image_builtin_print;
image_class->compute = gtk_css_image_builtin_compute;
image_class->equal = gtk_css_image_builtin_equal;
- image_class->transition = gtk_css_image_builtin_transition;
object_class->dispose = gtk_css_image_builtin_dispose;
}
static void
gtk_css_image_builtin_init (GtkCssImageBuiltin *builtin)
{
+ /* white background */
+ builtin->bg_color.red = builtin->bg_color.green = builtin->bg_color.blue = builtin->bg_color.alpha = 1.0;
+ /* black foreground */
+ builtin->fg_color.alpha = 1.0;
}
GtkCssImage *
cairo_t *cr,
double width,
double height,
- GtkCssImageBuiltinType image_type,
- const GdkRGBA * fg_color,
- const GdkRGBA * bg_color,
- const GdkRGBA * border_color,
- int border_width)
+ GtkCssImageBuiltinType image_type)
{
switch (image_type)
{
gtk_css_image_builtin_draw_check (image, cr,
width, height,
image_type == GTK_CSS_IMAGE_BUILTIN_CHECK_CHECKED,
- image_type == GTK_CSS_IMAGE_BUILTIN_CHECK_INCONSISTENT,
- fg_color, bg_color,
- border_color, border_width);
+ image_type == GTK_CSS_IMAGE_BUILTIN_CHECK_INCONSISTENT);
break;
case GTK_CSS_IMAGE_BUILTIN_OPTION:
case GTK_CSS_IMAGE_BUILTIN_OPTION_CHECKED:
gtk_css_image_builtin_draw_option (image, cr,
width, height,
image_type == GTK_CSS_IMAGE_BUILTIN_OPTION_CHECKED,
- image_type == GTK_CSS_IMAGE_BUILTIN_OPTION_INCONSISTENT,
- fg_color, bg_color,
- border_color, border_width);
+ image_type == GTK_CSS_IMAGE_BUILTIN_OPTION_INCONSISTENT);
break;
case GTK_CSS_IMAGE_BUILTIN_ARROW_UP:
case GTK_CSS_IMAGE_BUILTIN_ARROW_DOWN:
case GTK_CSS_IMAGE_BUILTIN_ARROW_RIGHT:
gtk_css_image_builtin_draw_arrow (image, cr,
width, height,
- image_type,
- fg_color);
+ image_type);
break;
case GTK_CSS_IMAGE_BUILTIN_EXPANDER_HORIZONTAL_LEFT:
gtk_css_image_builtin_draw_expander (image, cr,
width, height,
- TRUE, FALSE, FALSE,
- fg_color, border_color);
+ TRUE, FALSE, FALSE);
break;
case GTK_CSS_IMAGE_BUILTIN_EXPANDER_VERTICAL_LEFT:
gtk_css_image_builtin_draw_expander (image, cr,
width, height,
- FALSE, FALSE, FALSE,
- fg_color, border_color);
+ FALSE, FALSE, FALSE);
break;
case GTK_CSS_IMAGE_BUILTIN_EXPANDER_HORIZONTAL_RIGHT:
gtk_css_image_builtin_draw_expander (image, cr,
width, height,
- TRUE, TRUE, FALSE,
- fg_color, border_color);
+ TRUE, TRUE, FALSE);
break;
case GTK_CSS_IMAGE_BUILTIN_EXPANDER_VERTICAL_RIGHT:
gtk_css_image_builtin_draw_expander (image, cr,
width, height,
- FALSE, TRUE, FALSE,
- fg_color, border_color);
+ FALSE, TRUE, FALSE);
break;
case GTK_CSS_IMAGE_BUILTIN_EXPANDER_HORIZONTAL_LEFT_EXPANDED:
gtk_css_image_builtin_draw_expander (image, cr,
width, height,
- TRUE, FALSE, TRUE,
- fg_color, border_color);
+ TRUE, FALSE, TRUE);
break;
case GTK_CSS_IMAGE_BUILTIN_EXPANDER_VERTICAL_LEFT_EXPANDED:
gtk_css_image_builtin_draw_expander (image, cr,
width, height,
- FALSE, FALSE, TRUE,
- fg_color, border_color);
+ FALSE, FALSE, TRUE);
break;
case GTK_CSS_IMAGE_BUILTIN_EXPANDER_HORIZONTAL_RIGHT_EXPANDED:
gtk_css_image_builtin_draw_expander (image, cr,
width, height,
- TRUE, TRUE, TRUE,
- fg_color, border_color);
+ TRUE, TRUE, TRUE);
break;
case GTK_CSS_IMAGE_BUILTIN_EXPANDER_VERTICAL_RIGHT_EXPANDED:
gtk_css_image_builtin_draw_expander (image, cr,
width, height,
- FALSE, TRUE, TRUE,
- fg_color, border_color);
+ FALSE, TRUE, TRUE);
break;
case GTK_CSS_IMAGE_BUILTIN_GRIP_TOPLEFT:
case GTK_CSS_IMAGE_BUILTIN_GRIP_TOP:
case GTK_CSS_IMAGE_BUILTIN_GRIP_LEFT:
gtk_css_image_builtin_draw_grip (image, cr,
width, height,
- image_type,
- bg_color);
+ image_type);
break;
case GTK_CSS_IMAGE_BUILTIN_PANE_SEPARATOR:
gtk_css_image_builtin_draw_pane_separator (image, cr,
- width, height,
- bg_color);
+ width, height);
break;
case GTK_CSS_IMAGE_BUILTIN_HANDLE:
gtk_css_image_builtin_draw_handle (image, cr,
- width, height,
- bg_color);
+ width, height);
break;
case GTK_CSS_IMAGE_BUILTIN_SPINNER:
gtk_css_image_builtin_draw_spinner (image, cr,
- width, height,
- fg_color);
+ width, height);
break;
}
}
gdouble width,
gdouble height)
{
- GtkBorderStyle border_style;
GtkStateFlags state;
GtkCssImageBuiltinType image_type;
- gint border_width;
state = gtk_style_context_get_state (context);
if (state & GTK_STATE_FLAG_INCONSISTENT)
if (render_icon_image (context, cr, x, y, width, height))
return;
- border_style = _gtk_css_border_style_value_get (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_BORDER_TOP_STYLE));
- if (border_style == GTK_BORDER_STYLE_SOLID)
- {
- GtkBorder border;
-
- border.top = _gtk_css_number_value_get (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_BORDER_TOP_WIDTH), 100);
- border.right = _gtk_css_number_value_get (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_BORDER_RIGHT_WIDTH), 100);
- border.bottom = _gtk_css_number_value_get (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_BORDER_BOTTOM_WIDTH), 100);
- border.left = _gtk_css_number_value_get (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_BORDER_LEFT_WIDTH), 100);
-
- border_width = MIN (MIN (border.top, border.bottom),
- MIN (border.left, border.right));
- }
- else
- {
- border_width = 0;
- }
-
cairo_translate (cr, x, y);
gtk_css_image_builtin_draw (_gtk_css_image_value_get_image (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_ICON_SOURCE)),
cr,
width, height,
- image_type,
- _gtk_css_rgba_value_get_rgba (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_COLOR)),
- _gtk_css_rgba_value_get_rgba (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_BACKGROUND_COLOR)),
- _gtk_css_rgba_value_get_rgba (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_BORDER_TOP_COLOR)),
- border_width);
+ image_type);
}
/**
gdouble width,
gdouble height)
{
- GtkBorderStyle border_style;
GtkStateFlags state;
GtkCssImageBuiltinType image_type;
- gint border_width;
state = gtk_style_context_get_state (context);
if (state & GTK_STATE_FLAG_INCONSISTENT)
if (render_icon_image (context, cr, x, y, width, height))
return;
- border_style = _gtk_css_border_style_value_get (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_BORDER_TOP_STYLE));
- if (border_style == GTK_BORDER_STYLE_SOLID)
- {
- GtkBorder border;
-
- border.top = _gtk_css_number_value_get (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_BORDER_TOP_WIDTH), 100);
- border.right = _gtk_css_number_value_get (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_BORDER_RIGHT_WIDTH), 100);
- border.bottom = _gtk_css_number_value_get (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_BORDER_BOTTOM_WIDTH), 100);
- border.left = _gtk_css_number_value_get (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_BORDER_LEFT_WIDTH), 100);
-
- border_width = MIN (MIN (border.top, border.bottom),
- MIN (border.left, border.right));
- }
- else
- {
- border_width = 0;
- }
-
cairo_translate (cr, x, y);
gtk_css_image_builtin_draw (_gtk_css_image_value_get_image (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_ICON_SOURCE)),
cr,
width, height,
- image_type,
- _gtk_css_rgba_value_get_rgba (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_COLOR)),
- _gtk_css_rgba_value_get_rgba (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_BACKGROUND_COLOR)),
- _gtk_css_rgba_value_get_rgba (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_BORDER_TOP_COLOR)),
- border_width);
+ image_type);
}
/**
gdouble y,
gdouble size)
{
- GtkBorderStyle border_style;
GtkCssImageBuiltinType image_type;
- gint border_width;
/* map [0, 2 * pi) to [0, 4) */
angle = round (2 * angle / G_PI);
if (render_icon_image (context, cr, x, y, size, size))
return;
- border_style = _gtk_css_border_style_value_get (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_BORDER_TOP_STYLE));
- if (border_style == GTK_BORDER_STYLE_SOLID)
- {
- GtkBorder border;
-
- border.top = _gtk_css_number_value_get (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_BORDER_TOP_WIDTH), 100);
- border.right = _gtk_css_number_value_get (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_BORDER_RIGHT_WIDTH), 100);
- border.bottom = _gtk_css_number_value_get (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_BORDER_BOTTOM_WIDTH), 100);
- border.left = _gtk_css_number_value_get (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_BORDER_LEFT_WIDTH), 100);
-
- border_width = MIN (MIN (border.top, border.bottom),
- MIN (border.left, border.right));
- }
- else
- {
- border_width = 0;
- }
-
cairo_translate (cr, x, y);
gtk_css_image_builtin_draw (_gtk_css_image_value_get_image (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_ICON_SOURCE)),
cr,
size, size,
- image_type,
- _gtk_css_rgba_value_get_rgba (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_COLOR)),
- _gtk_css_rgba_value_get_rgba (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_BACKGROUND_COLOR)),
- _gtk_css_rgba_value_get_rgba (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_BORDER_TOP_COLOR)),
- border_width);
+ image_type);
}
/**
gdouble width,
gdouble height)
{
- GtkBorderStyle border_style;
GtkCssImageBuiltinType image_type;
GtkStateFlags state;
- gint border_width;
state = gtk_style_context_get_state (context);
if (gtk_style_context_has_class (context, "horizontal"))
if (render_icon_image (context, cr, x, y, width, height))
return;
- border_style = _gtk_css_border_style_value_get (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_BORDER_TOP_STYLE));
- if (border_style == GTK_BORDER_STYLE_SOLID)
- {
- GtkBorder border;
-
- border.top = _gtk_css_number_value_get (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_BORDER_TOP_WIDTH), 100);
- border.right = _gtk_css_number_value_get (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_BORDER_RIGHT_WIDTH), 100);
- border.bottom = _gtk_css_number_value_get (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_BORDER_BOTTOM_WIDTH), 100);
- border.left = _gtk_css_number_value_get (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_BORDER_LEFT_WIDTH), 100);
-
- border_width = MIN (MIN (border.top, border.bottom),
- MIN (border.left, border.right));
- }
- else
- {
- border_width = 0;
- }
-
cairo_translate (cr, x, y);
gtk_css_image_builtin_draw (_gtk_css_image_value_get_image (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_ICON_SOURCE)),
cr,
width, height,
- image_type,
- _gtk_css_rgba_value_get_rgba (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_COLOR)),
- _gtk_css_rgba_value_get_rgba (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_BACKGROUND_COLOR)),
- _gtk_css_rgba_value_get_rgba (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_BORDER_TOP_COLOR)),
- border_width);
+ image_type);
}
/**
gdouble height)
{
GtkCssImageBuiltinType type;
- GtkBorderStyle border_style;
- gint border_width;
gtk_render_background (context, cr, x, y, width, height);
gtk_render_frame (context, cr, x, y, width, height);
if (render_icon_image (context, cr, x, y, width, height))
return;
- border_style = _gtk_css_border_style_value_get (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_BORDER_TOP_STYLE));
- if (border_style == GTK_BORDER_STYLE_SOLID)
- {
- GtkBorder border;
-
- border.top = _gtk_css_number_value_get (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_BORDER_TOP_WIDTH), 100);
- border.right = _gtk_css_number_value_get (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_BORDER_RIGHT_WIDTH), 100);
- border.bottom = _gtk_css_number_value_get (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_BORDER_BOTTOM_WIDTH), 100);
- border.left = _gtk_css_number_value_get (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_BORDER_LEFT_WIDTH), 100);
-
- border_width = MIN (MIN (border.top, border.bottom),
- MIN (border.left, border.right));
- }
- else
- {
- border_width = 0;
- }
-
cairo_translate (cr, x, y);
if (gtk_style_context_has_class (context, GTK_STYLE_CLASS_GRIP))
gtk_css_image_builtin_draw (_gtk_css_image_value_get_image (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_ICON_SOURCE)),
cr,
width, height,
- type,
- _gtk_css_rgba_value_get_rgba (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_COLOR)),
- _gtk_css_rgba_value_get_rgba (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_BACKGROUND_COLOR)),
- _gtk_css_rgba_value_get_rgba (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_BORDER_TOP_COLOR)),
- border_width);
+ type);
}
/**
gdouble width,
gdouble height)
{
- GtkBorderStyle border_style;
- gint border_width;
-
if (render_icon_image (context, cr, x, y, width, height))
return;
- border_style = _gtk_css_border_style_value_get (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_BORDER_TOP_STYLE));
- if (border_style == GTK_BORDER_STYLE_SOLID)
- {
- GtkBorder border;
-
- border.top = _gtk_css_number_value_get (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_BORDER_TOP_WIDTH), 100);
- border.right = _gtk_css_number_value_get (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_BORDER_RIGHT_WIDTH), 100);
- border.bottom = _gtk_css_number_value_get (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_BORDER_BOTTOM_WIDTH), 100);
- border.left = _gtk_css_number_value_get (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_BORDER_LEFT_WIDTH), 100);
-
- border_width = MIN (MIN (border.top, border.bottom),
- MIN (border.left, border.right));
- }
- else
- {
- border_width = 0;
- }
-
cairo_translate (cr, x, y);
gtk_css_image_builtin_draw (_gtk_css_image_value_get_image (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_ICON_SOURCE)),
cr,
width, height,
- GTK_CSS_IMAGE_BUILTIN_SPINNER,
- _gtk_css_rgba_value_get_rgba (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_COLOR)),
- _gtk_css_rgba_value_get_rgba (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_BACKGROUND_COLOR)),
- _gtk_css_rgba_value_get_rgba (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_BORDER_TOP_COLOR)),
- border_width);
+ GTK_CSS_IMAGE_BUILTIN_SPINNER);
}
/**